/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * cadastroAnim.java
 *
 * Created on 29/09/2009, 21:33:21
 */

package cparc;

import com.mysql.jdbc.Statement;
import com.toedter.calendar.JDateChooser;
import java.sql.ResultSet;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFormattedTextField;
import javax.swing.JOptionPane;
import javax.swing.text.MaskFormatter;



/**
 *
 * @author Administrador
 */
public class cadastroAnim extends javax.swing.JInternalFrame {
    private boolean editar = false;
    private boolean novo = false;
    private boolean excluir = false;
    static Home frameHome;
    String acodOld = null;

    public void setHome(Home home){

        frameHome = home;
    }
    public void animal(String anCod, String anNom, String aPro){
            tfCodAnim.setText(anCod);
            tfNomAnimal.setText(anNom);
            tfCodProp.setText(aPro);
            this.InserirDados(anCod,aPro);
    }

     public void raca(String rCod, String rNom){
            tfCodRac.setText(rCod);
            tfRacNom.setText(rNom);
            tfSexCod.requestFocusInWindow();
            tfSexCod.selectAll();
    }
     public void escAnimal(){

            tfCodAnim.requestFocusInWindow();
            tfCodAnim.selectAll();
    }
     public void escRaca(){

            tfSexCod.requestFocusInWindow();
            tfSexCod.selectAll();
    }
     public void usuario(String Aprop, String PropNom){

            tfCodProp.setText(Aprop);
            tfNomProp.setText(PropNom);
            tfCodProp.requestFocusInWindow();
            tfCodProp.selectAll();
            this.InserirUsuario(Aprop);
    }
     public void escUsuario(){

            tfCodProp.requestFocusInWindow();
            tfCodProp.selectAll();
    }
   /*  public void formatarDatas( javax.swing.JFormattedTextField tCampo , Date data){

         SimpleDateFormat data2 =  new SimpleDateFormat("dd/MM/yyyy");
         tCampo.setText(data2.format(data));
         try {
             data2.parse(tCampo.getText());
        } catch (ParseException ex) {
            //Logger.getLogger(cadastroAnim.class.getName()).log(Level.SEVERE, null, ex);
        }
    }*/

      public String sqlData(com.toedter.calendar.JDateChooser tCampo){
          System.out.println("entrou");
          Date data = tCampo.getDate();

            if(data == null){
                 System.out.println("entrou2");
                  System.out.println(data);
                return null;

            }else{
                 String dataSql =  new SimpleDateFormat("yyyy-MM-dd").format(data);

                System.out.println(dataSql);
               return "'" + dataSql + "'";
            }
      }
   
     //completa os dados da consulta do animal para edicao;
     public void InserirDados(String anCod, String aPro){
            String acod = anCod;
            String anom = null;
            String aant = null;
            String apro = null;
            String abai = null;
            String arua = null;
            String anum = null;
            String afic = null;
            String aesp = null;
            String arac = null;
            String asex = null;
            String apor = null;
            String apel = null;
            String acol = null;
            String acap = null;
            String asit = null;
            String afin = null;
            String aida = null;

            String pnom = null;
            String bnom = null;
            String rnom = null;
            String racnom = null;
             //PEGA O ACOD ANTIGO PARA FAZER O UPDATE;
             acodOld = this.getAcod();
            System.out.println(acodOld);
            Statement stm = null;
            String consulta = "SELECT * FROM CPARC.CAD_ANIM WHERE ACOD = " + acod;
             System.out.println(consulta);
            try  {
                stm = (Statement) conexao.getConnection(true).createStatement();
                ResultSet rs = stm.executeQuery(consulta);
                rs.next();

                acod = rs.getString("ACOD");
                anom = rs.getString("ANOM");
                aant = rs.getString("AANT");
                apro = rs.getString("APRO");
                abai = rs.getString("ABAI");
                arua = rs.getString("ARUA");
                anum = rs.getString("ANUM");
                afic = rs.getString("AFIC");
                aesp = rs.getString("AESP");
                arac = rs.getString("ARAC");
                asex = rs.getString("ASEX");
                apor = rs.getString("APOR");
                apel = rs.getString("APEL");
                acol = rs.getString("ACOL");
                acap = rs.getString("ACAP");
                asit = rs.getString("ASIT");
                afin = rs.getString("AFIN");
                aida = rs.getString("AIDA");
            }
            catch(Exception e){
                String status = e.getMessage();
                System.out.println(status);
            }
        tfCodAnim.setText(acod);
        tfNomAnimal.setText(anom);
        tfCodBai.setText(abai);
        tfCodRua.setText(arua);
        tfNum.setText(anum);
        tfCodProp.setText(apro);
        tfEspCod.setText(aesp);
         if(aesp.equals("1"))
            tfEspNom.setText("Canino");
        else
            tfEspNom.setText("Felino");
  	tfCodRac.setText(arac);
        //preencher codigo e sexo;
        tfSexCod.setText(asex);
        if(asex.equals("2"))
            tfSexNom.setText("Macho");
        else
            tfSexNom.setText("Fêmea");
        //prencher codigo e porte;
        tfPortCod.setText(apor);
        if(apor.equals("1"))
                    tfPortNom.setText("Pequeno");
        else if(apor.equals("2"))
                    tfPortNom.setText("Médio");
        else if (apor.equals("3"))
                    tfPortNom.setText("Grande");
        
        tfCor.setText(acol);

        tfSitCod.setText(asit);
         if(asit.equals("1"))
            tfSitNom.setText("Cadastrado e vacinado");
        else if (asit.equals("2"))
            tfSitNom.setText("Cadastrado");

        tfFinCod.setText(afin);
            if(afin.equals("1"))
                tfFinNom.setText("Companhia");
        else if (afin.equals("2"))
                tfFinNom.setText("Cão-Guia");
        
        //preencher codigo e pelagem;
        tfPelCod.setText(apel);
        if(apel.equals("1"))
                    tfPelNom.setText("Curta");
        else if(apel.equals("2"))
                    tfPelNom.setText("Médio");
        else if (apel.equals("3"))
                    tfPelNom.setText("Longa");
        tfIdade.setText(aida);
           // consulta tabela proprietarios;
         Statement stmProp = null;
         String consultaPro = "SELECT * FROM CPARC.CAD_PROP WHERE PCOD = " + aPro;
         System.out.println(consultaPro);
            try  {
                stmProp = (Statement) conexao.getConnection(true).createStatement();
                ResultSet rs = stm.executeQuery(consultaPro);
                rs.next();

                pnom = rs.getString("PNOM");
            }
            catch(Exception e){
                String status = e.getMessage();
                System.out.println(status);
            }
        tfNomProp.setText(pnom);

        //consulta tabela bairros
         Statement stmBai = null;
         String consultaBai = "SELECT * FROM CPARC.CAD_BAI WHERE BCOD = " + abai;
         System.out.println(consultaBai);
            try  {
                stmBai = (Statement) conexao.getConnection(true).createStatement();
                ResultSet rs = stm.executeQuery(consultaBai);
                rs.next();

                bnom = rs.getString("BNOM");
            }
            catch(Exception e){
                String status = e.getMessage();
                System.out.println(status);
            }
            tfNomBai.setText(bnom);
            //consulta tabela ruas;
         Statement stmRua = null;
         String consultaRua = "SELECT * FROM CPARC.CAD_RUAS WHERE RCOD = " + arua;
         System.out.println(consultaRua);
            try  {
                stmRua = (Statement) conexao.getConnection(true).createStatement();
                ResultSet rs = stm.executeQuery(consultaRua);
                rs.next();

                rnom = rs.getString("RNOM");
            }
            catch(Exception e){
                String status = e.getMessage();
                System.out.println(status);
            }
            tfNomRua.setText(rnom);
                //consulta tabela Raças;
         Statement stmRac = null;
         String consultaRac = "SELECT * FROM CPARC.CAD_RACAS WHERE RCOD = " + arac;
         System.out.println(consultaRac);
            try  {
                stmRac = (Statement) conexao.getConnection(true).createStatement();
                ResultSet rs = stm.executeQuery(consultaRac);
                rs.next();

                racnom = rs.getString("RNOM");
            }
            catch(Exception e){
                String status = e.getMessage();
                System.out.println(status);
            }
            tfRacNom.setText(racnom);

             //consulta tabela Vacinas;
            Date Vac1 = null; Date Vac2 = null;Date Vac3 = null;Date Vac4 = null;Date Vac5 = null;
            Date Vac6 = null;Date Vac7 = null;Date Vac8 = null;Date Vac9 = null;Date Vac10 = null;
         Statement stmVac = null;
         String consultaVac = "SELECT * FROM CPARC.CAD_VACIN WHERE VCOD = "+ acod+" and "+ apro +"";
         System.out.println(consultaVac);
            try  {
                stmVac = (Statement) conexao.getConnection(true).createStatement();
                ResultSet rs = stmVac.executeQuery(consultaVac);
                rs.next();
                Vac1 = rs.getDate("VVAC1");Vac2 = rs.getDate("VVAC2");Vac3 = rs.getDate("VVAC3");Vac4 = rs.getDate("VVAC4");
                Vac5 = rs.getDate("VVAC5");Vac6 = rs.getDate("VVAC6");Vac7 = rs.getDate("VVAC7");
                Vac8 = rs.getDate("VVAC8");Vac9 = rs.getDate("VVAC9");Vac10 = rs.getDate("VVAC10");
            }
            catch(Exception e){
                String status = e.getMessage();
                System.out.println(status);
            }
           if(Vac1 != null)
              vac1.setDate(Vac1);
           if(Vac2 != null)
              vac2.setDate(Vac2);
           if(Vac3 != null)
            vac3.setDate(Vac3);
           if(Vac4 != null)
            vac4.setDate(Vac4);
           if(Vac5 != null)
            vac5.setDate(Vac5);
           if(Vac6 != null)
            vac6.setDate(Vac6);
           if(Vac7 != null)
            vac7.setDate(Vac7);
           if(Vac8 != null)
            vac8.setDate(Vac8);
           if(Vac9 != null)
            vac9.setDate(Vac9);
           if(Vac10 != null)
            vac10.setDate(Vac10);

          // this.formatarDatas(vac11, Vac11);this.formatarDatas(vac12, Vac12);
          // this.formatarDatas(vac13, Vac13);this.formatarDatas(vac14, Vac14);
          // this.formatarDatas(vac15, Vac15);this.formatarDatas(vac16, Vac16);
  
       if(editar){
            tfCodAnim.enable();
            tfCodProp.enable();
            tfEspCod.enable();
            tfCodRac.enable();
            tfSexCod.enable();
            tfPortCod.enable();
            tfCor.enable();
            tfSitCod.enable();
            tfFinCod.enable();
            tfPelCod.enable();
            tfIdade.enable();
            vac1.setEnabled(true);vac2.setEnabled(true);vac3.setEnabled(true);vac4.setEnabled(true);vac5.setEnabled(true);
            vac6.setEnabled(true);vac7.setEnabled(true);vac8.setEnabled(true);vac9.setEnabled(true);vac10.setEnabled(true);
            vac11.setEnabled(true);vac12.setEnabled(true);vac13.setEnabled(true);vac14.setEnabled(true);vac15.setEnabled(true);vac16.setEnabled(true);
            tfCodAnim.requestFocusInWindow();
       }
       if(excluir)
           this.disableCampos();
     }

     public void InserirUsuario(String Pcod){
            Statement stmProp = null;
            String apro = Pcod;
            String pbai = null;
            String prua = null;
            String bnom = null;
            String rnom = null;
            String pnum = null;
            String pnom = null;
         String consultaPro = "SELECT * FROM CPARC.CAD_PROP WHERE PCOD = " + apro;
         System.out.println(consultaPro);
            try  {
                stmProp = (Statement) conexao.getConnection(true).createStatement();
                ResultSet rs = stmProp.executeQuery(consultaPro);
                rs.next();

                pbai = rs.getString("PBAI");
                prua = rs.getString("PEND");
                pnum = rs.getString("PNUM");
                pnom = rs.getString("PNOM");
            }
            catch(Exception e){
                String status = e.getMessage();
                System.out.println(status);
            }
            tfNum.setText(pnum);
            tfNomProp.setText(pnom);

        //consulta tabela bairros
          Statement stmBai = null;
         String consultaBai = "SELECT * FROM CPARC.CAD_BAI WHERE BCOD = " + pbai;
         System.out.println(consultaBai);
            try  {
                stmBai = (Statement) conexao.getConnection(true).createStatement();
                ResultSet rs = stmBai.executeQuery(consultaBai);
                rs.next();

                bnom = rs.getString("BNOM");
                pbai = rs.getString("BCOD");
            }
            catch(Exception e){
                String status = e.getMessage();
                System.out.println(status);
            }
            tfNomBai.setText(bnom);
            tfCodBai.setText(pbai);
            //consulta tabela ruas;
          Statement stmRua = null;
         String consultaRua = "SELECT * FROM CPARC.CAD_RUAS WHERE RCOD = " + prua;
         System.out.println(consultaRua);
            try  {
                stmRua = (Statement) conexao.getConnection(true).createStatement();
                ResultSet rs = stmRua.executeQuery(consultaRua);
                rs.next();

                rnom = rs.getString("RNOM");
                prua = rs.getString("RCOD");
            }
            catch(Exception e){
                String status = e.getMessage();
                System.out.println(status);
            }
            tfNomRua.setText(rnom);
            tfCodRua.setText(prua);
     }

     public void disableCampos(){
        if(excluir == true){
            tfCodAnim.enable(false);
        }else{
            tfCodAnim.disable();
        }
        tfNomAnimal.disable();
        tfCodBai.disable();
        tfCodRua.disable();
        tfCodProp.disable();
        tfEspCod.disable();
  	tfCodRac.disable();
        tfSexCod.disable();
        tfSexNom.disable();
        tfPortCod.disable();
        tfPortNom.disable();
        tfCor.disable();
        tfSitCod.disable();
        tfFinCod.disable();
        tfPelCod.disable();
        tfPelNom.disable();
        tfRacNom.disable();
        tfNomRua.disable();
        tfNomBai.disable();
        tfNomProp.disable();
        tfIdade.disable();
        tfSitNom.disable();
        tfNum.disable();
        tfFinNom.disable();
        tfEspNom.disable();
        vac1.setEnabled(false);vac2.setEnabled(false);vac3.setEnabled(false);vac4.setEnabled(false);vac5.setEnabled(false);
        vac6.setEnabled(false);vac7.setEnabled(false);vac8.setEnabled(false);vac9.setEnabled(false);vac10.setEnabled(false);
        vac11.setEnabled(false);vac12.setEnabled(false);vac13.setEnabled(false);vac14.setEnabled(false);vac15.setEnabled(false);vac16.setEnabled(false);
     }

     public void enableCampos(){

        tfCodAnim.enable();
        tfNomAnimal.enable();
        tfCodProp.enable();
        tfEspCod.enable();
  	tfCodRac.enable();
        tfSexCod.enable();
        tfPortCod.enable();
        tfCor.enable();
        tfSitCod.enable();
        tfFinCod.enable();
        tfPelCod.enable();
        tfIdade.enable();
        vac1.setEnabled(true);vac2.setEnabled(true);vac3.setEnabled(true);vac4.setEnabled(true);vac5.setEnabled(true);
        vac6.setEnabled(true);vac7.setEnabled(true);vac8.setEnabled(true);vac9.setEnabled(true);vac10.setEnabled(true);
        vac11.setEnabled(true);vac12.setEnabled(true);vac13.setEnabled(true);vac14.setEnabled(true);vac15.setEnabled(true);vac16.setEnabled(true);
        this.repaint();
     }

     public void setarCampos(){
         
        tfCodAnim.setText("");
        tfNomAnimal.setText("");
        tfCodBai.setText("");
        tfCodRua.setText("");
        tfCodProp.setText("");
        tfEspCod.setText("");
  	tfCodRac.setText("");
        tfSexCod.setText("");
        tfSexNom.setText("");
        tfPortCod.setText("");
        tfPortNom.setText("");
        tfCor.setText("");
        tfSitCod.setText("");
        tfFinCod.setText("");
        tfPelCod.setText("");
        tfPelNom.setText("");
        tfRacNom.setText("");
        tfNomRua.setText("");
        tfNomBai.setText("");
        tfNomProp.setText("");
        tfIdade.setText("");
        tfNum.setText("");
        tfEspNom.setText("");
        tfFinNom.setText("");
        tfSitNom.setText("");
        vac1.setDate(null);vac2.setDate(null);vac3.setDate(null);vac4.setDate(null);vac5.setDate(null);
        vac6.setDate(null);vac7.setDate(null);vac8.setDate(null);vac9.setDate(null);vac10.setDate(null);
        vac11.setDate(null);vac12.setDate(null);vac13.setDate(null);vac14.setDate(null);vac15.setDate(null);vac16.setDate(null);
        this.repaint();
     }

     public void setAcod(String Acod){
           tfCodAnim.setText(Acod);
     }
     
     public String getAcod() {
	   return tfCodAnim.getText();
	}
    /** Creates new form cadastroAnim */
   /* public void initFields() throws ParseException{

        MaskFormatter mask1 = new MaskFormatter("##/##/####");
        MaskFormatter mask2 = new MaskFormatter("##/##/####");
        MaskFormatter mask3 = new MaskFormatter("##/##/####");
        MaskFormatter mask4 = new MaskFormatter("##/##/####");
        MaskFormatter mask5 = new MaskFormatter("##/##/####");
        MaskFormatter mask6 = new MaskFormatter("##/##/####");
        MaskFormatter mask7 = new MaskFormatter("##/##/####");
        MaskFormatter mask8 = new MaskFormatter("##/##/####");
        MaskFormatter mask9 = new MaskFormatter("##/##/####");
        MaskFormatter mask10 = new MaskFormatter("##/##/####");
        MaskFormatter mask11 = new MaskFormatter("##/##/####");
        MaskFormatter mask12 = new MaskFormatter("##/##/####");
        MaskFormatter mask13 = new MaskFormatter("##/##/####");
        MaskFormatter mask14 = new MaskFormatter("##/##/####");
        MaskFormatter mask15 = new MaskFormatter("##/##/####");
        MaskFormatter mask16 = new MaskFormatter("##/##/####");

        mask1.install(vac1);
        mask2.install(vac2);
        mask3.install(vac3);
        mask4.install(vac4);
        mask5.install(vac5);
        mask6.install(vac6);
        mask7.install(vac7);
        mask8.install(vac8);
        mask9.install(vac9);
        mask10.install(vac10);
        mask11.install(vac11);
        mask12.install(vac12);
        mask13.install(vac13);
        mask14.install(vac14);
        mask15.install(vac15);
        mask16.install(vac16);

        tfCodAnim.setEnabled(false);
        tfCodProp.setEnabled(false);
        tfCodBai.setEnabled(false);
        tfCodRua.setEnabled(false);
        tfNomProp.setEnabled(false);
        tfNomRua.setEnabled(false);
        tfNum.setEnabled(false);
        tfEspCod.setEnabled(false);
        tfEspNom.setEnabled(false);
        tfCodRac.setEnabled(false);
        tfRacNom.setEnabled(false);
        tfSexNom.setEnabled(false);
        tfSexCod.setEnabled(false);
        tfPortNom.setEnabled(false);
        tfPortCod.setEnabled(false);
        tfPelCod.setEnabled(false);
        tfPelNom.setEnabled(false);
        tfCor.setEnabled(false);
        tfSitNom.setEnabled(false);
        tfSitCod.setEnabled(false);
        tfFinNom.setEnabled(false);
        tfFinCod.setEnabled(false);
        tfIdade.setEnabled(false);
        vac1.setEnabled(false);
        vac2.setEnabled(false);
        vac3.setEnabled(false);
        vac4.setEnabled(false);
        vac6.setEnabled(false);
        vac5.setEnabled(false);
        vac8.setEnabled(false);
        vac7.setEnabled(false);
        vac10.setEnabled(false);
        vac9.setEnabled(false);
        vac12.setEnabled(false);
        vac11.setEnabled(false);
        vac14.setEnabled(false);
        vac13.setEnabled(false);
        vac16.setEnabled(false);
        vac15.setEnabled(false);
        tfNomBai.setEnabled(false);
        tfNomAnimal.setEnabled(false);
    }*/

    public cadastroAnim()  {
        initComponents();
       // try {
        //    initFields();
       // } catch (ParseException ex) {
            //Logger.getLogger(cadastroAnim.class.getName()).log(Level.SEVERE, null, ex);
       // }
         disableCampos();
        }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        tfCodAnim = new javax.swing.JTextField();
        tfCodProp = new javax.swing.JTextField();
        tfCodBai = new javax.swing.JTextField();
        tfCodRua = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        tfNomProp = new javax.swing.JTextField();
        tfNomRua = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        tfEspCod = new javax.swing.JTextField();
        tfEspNom = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        tfCodRac = new javax.swing.JTextField();
        tfRacNom = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        tfSexNom = new javax.swing.JTextField();
        tfSexCod = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        tfPortNom = new javax.swing.JTextField();
        tfPortCod = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        tfPelCod = new javax.swing.JTextField();
        tfPelNom = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        tfCor = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        tfSitNom = new javax.swing.JTextField();
        tfSitCod = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        tfFinNom = new javax.swing.JTextField();
        tfFinCod = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        tfIdade = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        vac1 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac3 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac4 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac8 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac6 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac7 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac9 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac5 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac2 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac11 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac15 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac14 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac10 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac13 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac12 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        vac16 = new com.toedter.calendar.JDateChooser("dd/MM/yyyy" , "##/##/####" , ' ');
        tfNomBai = new javax.swing.JTextField();
        cbCadastro = new javax.swing.JCheckBox();
        tfNomAnimal = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        tfNum = new javax.swing.JTextField();
        btEditar = new javax.swing.JButton();
        btNovo = new javax.swing.JButton();
        btExcluir = new javax.swing.JButton();
        btSalvar = new javax.swing.JButton();

        setClosable(true);
        setTitle("Cadastro de Animais");
        setPreferredSize(new java.awt.Dimension(1000, 512));
        setRequestFocusEnabled(false);

        jPanel1.setPreferredSize(new java.awt.Dimension(50, 461));

        jLabel1.setText("Código do Animal");

        jLabel2.setText("Código do Proprietário");

        jLabel3.setText("Código do Bairro");

        jLabel4.setText("Código da Rua");

        tfCodAnim.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tfCodAnimKeyPressed(evt);
            }
        });

        tfCodProp.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tfCodPropKeyPressed(evt);
            }
        });

        jLabel5.setText("Nome");

        jLabel6.setText("Bairro");

        jLabel7.setText("Rua");

        jLabel8.setText("Espécie");

        tfEspCod.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tfEspCodKeyPressed(evt);
            }
        });

        jLabel9.setText("Raça");

        tfCodRac.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                tfCodRacFocusGained(evt);
            }
        });

        jLabel10.setText("Sexo");

        tfSexCod.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tfSexCodKeyPressed(evt);
            }
        });

        jLabel11.setText("Porte");

        tfPortCod.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tfPortCodKeyPressed(evt);
            }
        });

        jLabel12.setText("Pelagem");

        tfPelCod.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tfPelCodKeyPressed(evt);
            }
        });

        jLabel13.setText("Cor");

        tfCor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfCorActionPerformed(evt);
            }
        });
        tfCor.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tfCorKeyPressed(evt);
            }
        });

        jLabel14.setText("Situação");

        tfSitCod.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tfSitCodKeyPressed(evt);
            }
        });

        jLabel15.setText("Finalidade");

        tfFinCod.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tfFinCodKeyPressed(evt);
            }
        });

        jLabel16.setText("Idade");

        tfIdade.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tfIdadeKeyPressed(evt);
            }
        });

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Vacinas"));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(vac1, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vac2, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vac3, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(vac4, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(vac5, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vac6, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vac7, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(vac8, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(vac9, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vac10, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vac11, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(vac12, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(vac13, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vac14, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(vac15, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(vac16, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(20, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(vac1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vac4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vac2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vac3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(vac5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vac6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vac7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vac8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(vac9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vac10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vac11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vac12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(vac13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vac14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vac15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vac16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(18, Short.MAX_VALUE))
        );

        cbCadastro.setText("Modo Cadastro");
        cbCadastro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbCadastroActionPerformed(evt);
            }
        });

        tfNomAnimal.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tfNomAnimalKeyPressed(evt);
            }
        });

        jLabel17.setText("Nome do Animal");

        jLabel18.setText("Número");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel4)
                    .addComponent(jLabel2)
                    .addComponent(jLabel1)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9)
                    .addComponent(jLabel10)
                    .addComponent(jLabel11)
                    .addComponent(jLabel12)
                    .addComponent(jLabel13)
                    .addComponent(jLabel14)
                    .addComponent(jLabel15)
                    .addComponent(jLabel16)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(cbCadastro)
                        .addContainerGap())
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                                .addComponent(tfSexCod, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(tfSexNom))
                                            .addGroup(jPanel1Layout.createSequentialGroup()
                                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(tfPortCod, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(tfPelCod, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                    .addComponent(tfPortNom)
                                                    .addComponent(tfPelNom, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE))))
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                                .addComponent(tfFinCod, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(tfFinNom))
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                                .addComponent(tfSitCod, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(tfSitNom, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addComponent(tfIdade, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addComponent(tfCor, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                        .addComponent(tfCodRac, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(tfRacNom))
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                        .addComponent(tfEspCod, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(tfEspNom, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(jLabel18)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(tfNum, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGap(189, 189, 189))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(tfCodAnim, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(tfCodBai, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE)
                                .addComponent(tfCodProp, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE)
                                .addComponent(tfCodRua, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(jLabel17)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(tfNomAnimal, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                    .addComponent(jLabel6)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(tfNomBai))
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(tfNomRua, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(jLabel5)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(tfNomProp)))
                            .addContainerGap(383, Short.MAX_VALUE)))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tfCodAnim, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel17)
                            .addComponent(tfNomAnimal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tfCodProp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2)))
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel5)
                        .addComponent(tfNomProp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(tfNomBai, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(tfCodBai, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfCodRua, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(jLabel7)
                    .addComponent(tfNomRua, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(tfEspCod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfEspNom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel18)
                    .addComponent(tfNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(tfCodRac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfRacNom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel10)
                            .addComponent(tfSexNom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfSexCod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel11)
                            .addComponent(tfPortNom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfPortCod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel12)
                            .addComponent(tfPelCod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfPelNom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel13)
                            .addComponent(tfCor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel14)
                            .addComponent(tfSitCod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfSitNom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15)
                            .addComponent(tfFinCod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfFinNom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel16)
                            .addComponent(tfIdade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                        .addComponent(cbCadastro))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(32, 32, 32)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(46, 46, 46))))
        );

        btEditar.setText("Editar");
        btEditar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btEditarActionPerformed(evt);
            }
        });

        btNovo.setText("Novo");
        btNovo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btNovoActionPerformed(evt);
            }
        });

        btExcluir.setText("Excluir");
        btExcluir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btExcluirActionPerformed(evt);
            }
        });

        btSalvar.setText("Salvar");
        btSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btSalvarActionPerformed(evt);
            }
        });
        btSalvar.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                btSalvarKeyPressed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(91, 91, 91)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(btExcluir, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btSalvar, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(btEditar, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btNovo, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 850, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 380, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btEditar)
                    .addComponent(btNovo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btExcluir)
                    .addComponent(btSalvar))
                .addContainerGap(19, Short.MAX_VALUE))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-886)/2, (screenSize.height-502)/2, 886, 502);
    }// </editor-fold>//GEN-END:initComponents

    private void btEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btEditarActionPerformed
        this.setarCampos();
        this.disableCampos();
        editar =true;
        novo = false;
        excluir = false;
          
        pesqAnimal animal = new pesqAnimal();
             animal.setAnimal(this);
             Home.desk.add(animal);
             animal.setVisible(true);
    }//GEN-LAST:event_btEditarActionPerformed

    private void btNovoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btNovoActionPerformed
       this.setarCampos();
        novo = true;
        editar = false;
        excluir = false;
       this.enableCampos();

        Statement stm = null;
            String consulta = "SELECT MAX(ACOD) AS ULT FROM CPARC.CAD_ANIM";

            try  {
                stm = (Statement) conexao.getConnection(true).createStatement();
                ResultSet rs = stm.executeQuery(consulta);
                rs.next();
                tfCodAnim.setText(String.valueOf(rs.getInt("ULT") + 1));
            }
            catch(Exception e){
                String status = e.getMessage();
                System.out.println(status);
            }

            tfCodAnim.requestFocusInWindow();
            tfCodAnim.selectAll();
    }//GEN-LAST:event_btNovoActionPerformed

    private void btExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExcluirActionPerformed
           excluir = true;
           editar = false;
           novo =false;
        if(tfCodAnim.getText().isEmpty() || tfCodProp.getText().isEmpty() ){

           JOptionPane.showMessageDialog(rootPane, "Selecione um animal para excluir!", "Operação inválida", JOptionPane.WARNING_MESSAGE);
            pesqAnimal animal = new pesqAnimal();
             animal.setAnimal(this);
             Home.desk.add(animal);
             animal.setVisible(true);
             this.disableCampos();
       }
       else{
            Object[] options = { "Confirmar", "Cancelar" };
            int n = JOptionPane.showOptionDialog(null, "Deseja realmente excluir esse animal: " + tfNomAnimal.getText() + "!\n Realizar a exclusão?", "Operação de exclusão!", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);

            if (n == 0){

                Statement stm = null;
                String result = null;
                String consulta = "DELETE FROM CPARC.CAD_ANIM WHERE ACOD = " + tfCodAnim.getText();
                System.out.println(consulta);

                try  {
                    stm = (Statement) conexao.getConnection(true).createStatement();
                    int rs = stm.executeUpdate(consulta);
                    JOptionPane.showMessageDialog(rootPane, "Exclusão Efetuada Com Sucesso!", "Operação Realizada!", WIDTH);
                }
                catch(Exception e){
                    String status = e.getMessage();
                    System.out.println(status);
                    JOptionPane.showMessageDialog(rootPane, "Falha na Execução!", "Operação Não Realizada!", JOptionPane.ERROR_MESSAGE);

                }
                this.disableCampos();
                this.setarCampos();
                excluir = false;
            }
       }


    }//GEN-LAST:event_btExcluirActionPerformed

    @SuppressWarnings("static-access")
    private void btSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarActionPerformed
        if(editar){
            editar = false;
           System.out.println(acodOld);

            Object[] options = { "Confirmar", "Cancelar" };
            int n = JOptionPane.showOptionDialog(null, "Deseja realmente alterar o cadastro deste animal: "+ tfNomAnimal.getText().toUpperCase() +"\nExecutar?", "Operação de atualização!", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);

            if (n == 0)
            {
                Statement stm = null;
                String result = null;
                tfCodProp.enable();
                tfNomProp.enable();
                tfCodBai.enable();
                tfNomBai.enable();
                tfCodRua.enable();
                tfNomRua.enable();

                String consulta = "UPDATE CPARC.CAD_ANIM SET ACOD = "+ tfCodAnim.getText() +", AANT = '"+ " " +"' , APRO = "+ tfCodProp.getText() +" , " +
                                  "ABAI = "+ tfCodBai.getText()+" , ARUA = "+ tfCodRua.getText() +" , " +
                                 "ANUM = "+ tfNum.getText() +", AFIC = '"+ " " +"' , AESP = "+ tfEspCod.getText() +" , " +
                                 "ARAC = "+ tfCodRac.getText() +" , ASEX = "+ tfSexCod.getText() +" ," +
                                 "APOR = "+ tfPortCod.getText() +" , APEL = "+ tfPelCod.getText() +" , " +
                                 "ACOL = '"+ tfCor.getText().toUpperCase() +"' , ASIT = "+ tfSitCod.getText() +" , " +
                                 "AFIN = "+ tfFinCod.getText() +" ," + "AIDA = "+ tfIdade.getText() +" " +
                                 "WHERE ACOD =  " + acodOld +" ";
                                System.out.println(consulta);
                       //depois acrescentar as outras vacs....
                 String consulta2 = "UPDATE CPARC.CAD_VACIN SET VCOD = "+ tfCodAnim.getText() +", VPRO = '"+ tfCodProp.getText() +"' , VVAC1 = "+ sqlData(vac1) +" , " +
                                  "VVAC2 = "+ sqlData(vac2)+" ,VVAC3 = "+ sqlData(vac3) +" , " +
                                 "VVAC4 = "+ sqlData(vac4) +", VVAC5 = "+ sqlData(vac5) +" , VVAC6 = "+ sqlData(vac6) +" , " +
                                 "VVAC7 = "+ sqlData(vac7) +" , VVAC8 = "+ sqlData(vac8) +" ," +
                                 "VVAC9 = "+ sqlData(vac9) +" , VVAC10 = "+ sqlData(vac10) +" " +
                                 "WHERE VCOD =  " + acodOld +" ";
                                System.out.println(consulta2);
                try  {
                    stm = (Statement) conexao.getConnection(true).createStatement();
                    int rs = stm.executeUpdate(consulta);
                    int rs1 = stm.executeUpdate(consulta2);
                    JOptionPane.showMessageDialog(rootPane, "Atualizacão Efetuada Com Sucesso!", "Operação Realizada!", WIDTH);
                    }
                catch(Exception e){
                    String status = e.getMessage();
                    System.out.println(status);
                }
               this.disableCampos();
               this.setarCampos();
        }
             else{

                JOptionPane.showMessageDialog(rootPane, "Atualizacão Cancelada!", "Operação Cancelada!", WIDTH);

            }
            this.disableCampos();
            this.setarCampos();
     }
         else if (novo){
                
                Statement stm = null;
                String result = null;
                String consulta = "INSERT INTO CPARC.CAD_ANIM (ACOD, ANOM, AANT, APRO,ABAI, ARUA, ANUM, AFIC, AESP, ARAC, ASEX, APOR, APEL, ACOL, ACAP, ASIT, AFIN, AIDA) " +
                        "VALUES ("+ tfCodAnim.getText() +",'"+ tfNomAnimal.getText().toUpperCase() +"',' ',"+ tfCodProp.getText() +","+ tfCodBai.getText() +","+ tfCodRua.getText()+", "+tfNum.getText()+",' ', "+tfEspCod.getText()+", "+tfCodRac.getText()+", "+tfSexCod.getText()+", "+tfPortCod.getText()+", "+tfPelCod.getText()+",'"+tfCor.getText().toUpperCase()+"','0',"+tfSitCod.getText()+", "+tfFinCod.getText()+","+tfIdade.getText()+" )";

                System.out.println(consulta);
                try  {
                    stm = (Statement) conexao.getConnection(true).createStatement();
                    int rs = stm.executeUpdate(consulta);
                    JOptionPane.showMessageDialog(rootPane, "Inserção Efetuada Com Sucesso!", "Operação Realizada!", WIDTH);
                }
                catch(Exception e){
                    String status = e.getMessage();
                    System.out.println(status);
                    JOptionPane.showMessageDialog(rootPane, "ERRO! OPERAÇÃO NÃO REALIZADA", "Operação Não Realizada!", JOptionPane.ERROR_MESSAGE);
                }

                if(cbCadastro.isSelected()){

                    btNovo.doClick();
                }

                else{
                    novo = false;
                    this.disableCampos();
                    this.setarCampos();
                }

            }
    }//GEN-LAST:event_btSalvarActionPerformed

    private void cbCadastroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbCadastroActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cbCadastroActionPerformed

    private void tfCorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfCorActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tfCorActionPerformed

    private void btSalvarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_btSalvarKeyPressed
        if (evt.getKeyCode() == 10)

            btSalvar.doClick();
    }//GEN-LAST:event_btSalvarKeyPressed

    private void tfCodPropKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfCodPropKeyPressed
       if(evt.getKeyCode() == 10){
             
            this.InserirUsuario( tfCodProp.getText());
            tfEspCod.requestFocusInWindow();
            tfEspCod.selectAll();
        }

        if(evt.getKeyCode() == 114){

             pesqUsuario usuario = new pesqUsuario();
             usuario.setUsuario(this);
             Home.desk.add(usuario);
             usuario.setVisible(true);

         }
    }//GEN-LAST:event_tfCodPropKeyPressed

    private void tfCodRacFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfCodRacFocusGained

             pesqRaca raca = new pesqRaca();
             raca.setRaca(this);
             Home.desk.add(raca);
             raca.setVisible(true);
            
    }//GEN-LAST:event_tfCodRacFocusGained

    private void tfEspCodKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfEspCodKeyPressed
       if(evt.getKeyCode() == 10){
           if(novo){
                if( tfEspCod.getText().equals("1"))
                  tfEspNom.setText("Canino");
                else if(tfEspCod.getText().equals("2"))
                  tfEspNom.setText("Felino");

             tfCodRac.requestFocusInWindow();
             tfCodRac.selectAll();
            }if (editar){
                 if( tfEspCod.getText().equals("1"))
                  tfEspNom.setText("Canino");
             else if(tfEspCod.getText().equals("2"))
                  tfEspNom.setText("Felino");
             tfSexCod.requestFocusInWindow();
             tfSexCod.selectAll();
            }
       }
    }//GEN-LAST:event_tfEspCodKeyPressed

    private void tfSexCodKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfSexCodKeyPressed
        if(evt.getKeyCode() == 10){
            if(tfSexCod.getText().equals("2"))
                tfSexNom.setText("Macho");
            else if (tfSexCod.getText().equals("1"))
                tfSexNom.setText("Fêmea");

              tfPortCod.requestFocusInWindow();
              tfPortCod.selectAll();
       }
    }//GEN-LAST:event_tfSexCodKeyPressed

    private void tfPelCodKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfPelCodKeyPressed
         if(evt.getKeyCode() == 10){
            if(tfPelCod.getText().equals("1"))
                    tfPelNom.setText("Curta");
            else if(tfPelCod.getText().equals("2"))
                    tfPelNom.setText("Médio");
            else if (tfPelCod.getText().equals("3"))
                    tfPelNom.setText("Longa");

                  tfCor.requestFocusInWindow();
                  tfCor.selectAll();
       }
    }//GEN-LAST:event_tfPelCodKeyPressed

    private void tfPortCodKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfPortCodKeyPressed
       if(evt.getKeyCode() == 10){
             if( tfPortCod.getText().equals("1"))
                    tfPortNom.setText("Pequeno");
        else if(tfPortCod.getText().equals("2"))
                    tfPortNom.setText("Médio");
        else if (tfPortCod.getText().equals("3"))
                    tfPortNom.setText("Grande");

                  tfPelCod.requestFocusInWindow();
                  tfPelCod.selectAll();
       }
    }//GEN-LAST:event_tfPortCodKeyPressed

    private void tfCorKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfCorKeyPressed
            if(evt.getKeyCode() == 10){
                  tfSitCod.requestFocusInWindow();
                  tfSitCod.selectAll();
            }
    }//GEN-LAST:event_tfCorKeyPressed

    private void tfSitCodKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfSitCodKeyPressed
        if(evt.getKeyCode() == 10){
             if(  tfSitCod.getText().equals("1"))
                tfSitNom.setText("Cadastrado e vacinado");
            else if (tfSitCod.getText().equals("2"))
                tfSitNom.setText("Cadastrado");

              tfFinCod.requestFocusInWindow();
              tfFinCod.selectAll();
        }
    }//GEN-LAST:event_tfSitCodKeyPressed

    private void tfFinCodKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfFinCodKeyPressed
        if(evt.getKeyCode() == 10){
             if(tfFinCod.getText().equals("1"))
                tfFinNom.setText("Companhia");
             else if(tfFinCod.getText().equals("2"))
                tfFinNom.setText("Cão-Guia");

              tfIdade.requestFocusInWindow();
              tfIdade.selectAll();
        }
    }//GEN-LAST:event_tfFinCodKeyPressed

    private void tfIdadeKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfIdadeKeyPressed
             if(evt.getKeyCode() == 10){
                btSalvar.requestFocusInWindow();
             }
    }//GEN-LAST:event_tfIdadeKeyPressed

    private void tfCodAnimKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfCodAnimKeyPressed
         if(evt.getKeyCode() == 10 ){
             if(novo){
                tfNomAnimal.requestFocusInWindow();
                tfNomAnimal.selectAll();
             }else if(editar){
                  tfCodProp.requestFocusInWindow();
                  tfCodProp.selectAll();
             }
         }
    }//GEN-LAST:event_tfCodAnimKeyPressed

    private void tfNomAnimalKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfNomAnimalKeyPressed
             if(evt.getKeyCode() == 10){
                tfCodProp.requestFocusInWindow();
                tfCodProp.selectAll();
             }
    }//GEN-LAST:event_tfNomAnimalKeyPressed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btEditar;
    private javax.swing.JButton btExcluir;
    private javax.swing.JButton btNovo;
    private javax.swing.JButton btSalvar;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JCheckBox cbCadastro;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JTextField tfCodAnim;
    private javax.swing.JTextField tfCodBai;
    private javax.swing.JTextField tfCodProp;
    private javax.swing.JTextField tfCodRac;
    private javax.swing.JTextField tfCodRua;
    private javax.swing.JTextField tfCor;
    private javax.swing.JTextField tfEspCod;
    private javax.swing.JTextField tfEspNom;
    private javax.swing.JTextField tfFinCod;
    private javax.swing.JTextField tfFinNom;
    private javax.swing.JTextField tfIdade;
    private javax.swing.JTextField tfNomAnimal;
    private javax.swing.JTextField tfNomBai;
    private javax.swing.JTextField tfNomProp;
    private javax.swing.JTextField tfNomRua;
    private javax.swing.JTextField tfNum;
    private javax.swing.JTextField tfPelCod;
    private javax.swing.JTextField tfPelNom;
    private javax.swing.JTextField tfPortCod;
    private javax.swing.JTextField tfPortNom;
    private javax.swing.JTextField tfRacNom;
    private javax.swing.JTextField tfSexCod;
    private javax.swing.JTextField tfSexNom;
    private javax.swing.JTextField tfSitCod;
    private javax.swing.JTextField tfSitNom;
    private com.toedter.calendar.JDateChooser vac1;
    private com.toedter.calendar.JDateChooser vac10;
    private com.toedter.calendar.JDateChooser vac11;
    private com.toedter.calendar.JDateChooser vac12;
    private com.toedter.calendar.JDateChooser vac13;
    private com.toedter.calendar.JDateChooser vac14;
    private com.toedter.calendar.JDateChooser vac15;
    private com.toedter.calendar.JDateChooser vac16;
    private com.toedter.calendar.JDateChooser vac2;
    private com.toedter.calendar.JDateChooser vac3;
    private com.toedter.calendar.JDateChooser vac4;
    private com.toedter.calendar.JDateChooser vac5;
    private com.toedter.calendar.JDateChooser vac6;
    private com.toedter.calendar.JDateChooser vac7;
    private com.toedter.calendar.JDateChooser vac8;
    private com.toedter.calendar.JDateChooser vac9;
    // End of variables declaration//GEN-END:variables

}
